package com.ruoyi.product.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.product.mapper.TbCourseActivityMapper;
import com.ruoyi.product.domain.TbCourseActivity;
import com.ruoyi.product.service.ITbCourseActivityService;

/**
 * 秒杀Service业务层处理
 * 
 * @author Sun
 * @date 2023-01-30
 */
@Service
public class TbCourseActivityServiceImpl implements ITbCourseActivityService 
{
    @Autowired
    private TbCourseActivityMapper tbCourseActivityMapper;

    /**
     * 查询秒杀
     * 
     * @param activityId 秒杀主键
     * @return 秒杀
     */
    @Override
    public TbCourseActivity selectTbCourseActivityByActivityId(Integer activityId)
    {
        return tbCourseActivityMapper.selectTbCourseActivityByActivityId(activityId);
    }

    /**
     * 查询秒杀列表
     * 
     * @param tbCourseActivity 秒杀
     * @return 秒杀
     */
    @Override
    public List<TbCourseActivity> selectTbCourseActivityList(TbCourseActivity tbCourseActivity)
    {
        return tbCourseActivityMapper.selectTbCourseActivityList(tbCourseActivity);
    }

    /**
     * 新增秒杀
     * 
     * @param tbCourseActivity 秒杀
     * @return 结果
     */
    @Override
    public int insertTbCourseActivity(TbCourseActivity tbCourseActivity)
    {
        tbCourseActivity.setCreateTime(DateUtils.getNowDate());
        return tbCourseActivityMapper.insertTbCourseActivity(tbCourseActivity);
    }

    /**
     * 修改秒杀
     * 
     * @param tbCourseActivity 秒杀
     * @return 结果
     */
    @Override
    public int updateTbCourseActivity(TbCourseActivity tbCourseActivity)
    {
        tbCourseActivity.setUpdateTime(DateUtils.getNowDate());
        return tbCourseActivityMapper.updateTbCourseActivity(tbCourseActivity);
    }

    /**
     * 批量删除秒杀
     * 
     * @param activityIds 需要删除的秒杀主键
     * @return 结果
     */
    @Override
    public int deleteTbCourseActivityByActivityIds(Integer[] activityIds)
    {
        return tbCourseActivityMapper.deleteTbCourseActivityByActivityIds(activityIds);
    }

    /**
     * 删除秒杀信息
     * 
     * @param activityId 秒杀主键
     * @return 结果
     */
    @Override
    public int deleteTbCourseActivityByActivityId(Integer activityId)
    {
        return tbCourseActivityMapper.deleteTbCourseActivityByActivityId(activityId);
    }
}
